package com.jinke.api.modules.app.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.jinke.api.modules.app.enums.BalanceLogType;
import com.jinke.api.modules.app.enums.BalanceType;
import com.jinke.api.modules.base.model.BaseEntity;
import com.jinke.api.modules.ums.vo.SimpleUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author macro
 * @since 2024-01-13
 */
@Getter
@Setter
@TableName(autoResultMap = true)
@ApiModel(value = "资金明细对象", description = "")
public class BalanceLog extends BaseEntity {

    @ApiModelProperty("用户ID")
    private Integer userId;

    @ApiModelProperty("变动余额")
    private BigDecimal changeValue;

    @ApiModelProperty("变动后余额")
    private BigDecimal afterValue;

    @ApiModelProperty("变动类型 0充值 1下单 2退款 3保证金释放 4 账单补扣")
    private BalanceLogType type;

    @ApiModelProperty("0 余额，1保证金")
    private BalanceType balanceType;

    @ApiModelProperty("关联订单号")
    private String orderNo;

    @ApiModelProperty("备注")
    private String remark;

    @ApiModelProperty("用户实体信息")
    @TableField(exist = false)
    private SimpleUser user;


    @ApiModelProperty("销售ID")
    private Integer sellerId;

    @ApiModelProperty("详情")
//    @TableField(typeHandler = JacksonTypeHandler.class)
    private String details;
//    private List<LinkedHashMap<String,String>> details;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static  class Detail{
        private String key;
        private String value;
    }
}
